#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

int a[100005], n, maxx;
int cnt[100005];

int main(){
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);

    scanf("%d", &n);
    for (int i=1; i<=n; i++){
        scanf("%d", &a[i]);
        maxx = max(maxx, a[i]);
    }

    for (int i=1; i<=n; i++) cnt[a[i]]++;

    int lastx = 0, ans = 0;
    for (int i=1; i<=maxx; i++){
        if (!cnt[i]) continue;
        if (!lastx){
            lastx = cnt[i];
            continue;
        }
        ans += min(cnt[i], lastx);
    }

    printf("%d", n-ans);

    fclose(stdin);
    fclose(stdout);
    return 0;
}